<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>测试</title>
    <script type="text/javascript" src="/static/js/axios-0.18.0.min.js"></script>
    <script type="text/javascript">
        //请求服务器数据
        /**
        axios.get('http://127.0.0.1:8000/test2')
            .then(function (response) {
                alert(response.data.message)
            })
            .catch(function (error) {
                alert(error.response.status)

             })


             axios.get('http://127.0.0.1:8000/test2')
            .then(response => {
                alert(response.data.message)
            })
            .catch(error=> {
                alert(error.response.status)

            })
         */
        let data = {name:'研发部',create_date:'2010-1-1'}
        let config = {
            headers:{
                a:1,
            }
        }


        axios.post('http://127.0.0.1:8000/test2/',data.config)
            .then(response => {
                console.log(response);
                alert(response.data.message)
            })
            .catch( error => {
                console.log(response);
                alert(error.response.status)
            })
    </script>
</head>
<body>
    <h3>测试</h3>
</body>
</html>